<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : showMenubyCatalog.xsl
    Created on : May 24, 2013, 11:32 PM
    Author     : Kim
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>
    <xsl:param name="menu"/>
    <!-- TODO customize transformation rules
         syntax recommendation http://www.w3.org/TR/xslt
    -->
    <xsl:template match="products">
        <xsl:choose>
            <xsl:when test="product[catalogName=$menu]">
                <xsl:for-each select="product[catalogName=$menu]">
                    <xsl:if test="(noSell='0')">
                        <div class="product_box">
                            <a>
                                <img>
                                    <xsl:attribute name="src">
                                        <xsl:value-of select="Image"/>
                                    </xsl:attribute>
                                </img>
                            </a>
                            <h3>
                                <xsl:value-of select="proName"/>
                            </h3>
                            <p class="product_price">VND
                                <xsl:value-of select="format-number(Price, '###,###')"/>
                            </p>
                            <a style="cursor: hand; cursor: pointer;"  class="add_to_card">
                                <xsl:attribute name="onclick" >addToCart(<xsl:value-of select="proID"/>,'<xsl:value-of select="proName"/>',<xsl:value-of select="Price"/>)
                                </xsl:attribute> Add to Cart
                            </a>
                            <a href="#" onclick="viewProductDetail('{proID}')" class="detail">Detail</a>
                        </div>
                    </xsl:if>
                </xsl:for-each>
            </xsl:when>
            <xsl:otherwise>
                <a>No Product was Found</a>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

</xsl:stylesheet>
